package com.fk.his.biznorule.convertor;

import com.fk.his.domain.model.aggregates.BizNoRule;
import com.rickie.dto.data.BizNoRuleCO;
import com.rickie.dto.data.BizNoRuleAddCmd;
import org.springframework.beans.BeanUtils;

/**
 * <p>
 * 业务规则转换类
 * <p>
 * 示例代码
 * <pre>
 * </pre/>
 *
 * @author InHome
 * @version BME V100R001 2023/03/28
 * @since BME V100R001C40B104
 */
public final class BizNoRuleConvertor {

    /**
     * 把领域模型转换成DTO
     *
     * @param bizNoRule 领域模型对象
     * @return DTO对象
     */
    public static BizNoRuleCO toCO(BizNoRule bizNoRule) {
        BizNoRuleCO bizNoRuleDTO = new BizNoRuleCO();
        BeanUtils.copyProperties(bizNoRule, bizNoRuleDTO);
        return bizNoRuleDTO;
    }

    public static BizNoRule toDomain(BizNoRuleAddCmd bizNoRuleDTO) {
        BizNoRule bizNoRule = new BizNoRule(bizNoRuleDTO);
//        BeanUtil.copyProperties(bizNoRuleDTO, bizNoRule);
//        BeanUtils.copyProperties(bizNoRuleDTO,bizNoRule);
        return bizNoRule;
    }
}